import React from 'react'
import ReactDOM from 'react-dom/client'
import { HashRouter as Router, useRoutes } from 'react-router-dom'
import './index.css'
import store from './store'
import { Provider, useSelector } from 'react-redux'
// 动态生成路由组件
const GenerateRoutes: React.FC = () => {
  const { routes } = useSelector((state: RootState) => state.user)
  const Routes = useRoutes(routes)
  return Routes
}

ReactDOM.createRoot(document.getElementById('root')!).render(
  // <React.StrictMode>
  <Provider store={store}>
    <Router>
      <GenerateRoutes />
    </Router>
  </Provider>
  // </React.StrictMode>,
)
